package fz.vrd.app.fragment;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;

import android.os.Bundle;
import android.view.View;

import java.util.List;

import fz.vrd.app.R;
import fz.vrd.library.page.activity.BaseAc;
import fz.vrd.library.page.activity.BaseFragmentAc;

public class FragmentAc extends BaseFragmentAc {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.ac_fragment);
        getSupportActionBar().setTitle("fragment的使用");
        findViewById(R.id.btn_close).setOnClickListener(v -> {
            finish();
        });
        init();
    }

    void init() {
        Fragment1 fragment1 = new Fragment1();
        loadRootfragment(R.id.framelayout, fragment1, "fragment1");
    }

    public void addFrg(Fragment fragment) {
        replaceFragmentShow(fragment, fragment.getClass().getName(), true);
    }
}